<html>
<head><meta charset="utf-8"><title>crate required to be available in rlib format · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html">crate required to be available in rlib format</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="231023797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231023797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231023797">(Mar 19 2021 at 13:41)</a>:</h4>
<blockquote>
<p>error: crate <code>linkme</code> required to be available in rlib format, but was not found in this form</p>
</blockquote>
<p>I'm playing with taking a lib crate and <em>also</em> compiling it as a binary, similar to what <code>cargo test</code> does. I'm doing this via <code>cargo rustc -- --crate-type=bin</code>, but I get the above error.</p>
<p>There's <a href="https://github.com/rust-lang/cargo/pull/7008">an older issue</a> about this, but it doesn't seem immediately applicable. Any hints on some options I could do to make this work?</p>



<a name="231024143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231024143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231024143">(Mar 19 2021 at 13:43)</a>:</h4>
<p>What does <code>cargo rustc -v -- --crate-type=bin</code> show after a <code>cargo clean</code>?</p>



<a name="231024388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231024388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231024388">(Mar 19 2021 at 13:45)</a>:</h4>
<div class="codehilite"><pre><span></span><code> % cargo rustc -v -- --crate-type=bin --cfg=spec
   Compiling proc-macro2 v1.0.24
   Compiling unicode-xid v0.2.1
   Compiling syn v1.0.64
     Running `rustc --crate-name build_script_build --edition=2018 /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.24/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --cfg &#39;feature=&quot;default&quot;&#39; --cfg &#39;feature=&quot;proc-macro&quot;&#39; -C metadata=ea7ca98ab7742a44 -C extra-filename=-ea7ca98ab7742a44 --out-dir /private/tmp/demo/target/debug/build/proc-macro2-ea7ca98ab7742a44 -L dependency=/private/tmp/demo/target/debug/deps --cap-lints allow -C link-arg=-fuse-ld=/usr/local/bin/zld`
     Running `rustc --crate-name unicode_xid /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/unicode-xid-0.2.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg &#39;feature=&quot;default&quot;&#39; -C metadata=cd7f9054a6f1f9e9 -C extra-filename=-cd7f9054a6f1f9e9 --out-dir /private/tmp/demo/target/debug/deps -L dependency=/private/tmp/demo/target/debug/deps --cap-lints allow -C link-arg=-fuse-ld=/usr/local/bin/zld`
     Running `rustc --crate-name build_script_build --edition=2018 /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --cfg &#39;feature=&quot;clone-impls&quot;&#39; --cfg &#39;feature=&quot;default&quot;&#39; --cfg &#39;feature=&quot;derive&quot;&#39; --cfg &#39;feature=&quot;parsing&quot;&#39; --cfg &#39;feature=&quot;printing&quot;&#39; --cfg &#39;feature=&quot;proc-macro&quot;&#39; --cfg &#39;feature=&quot;quote&quot;&#39; -C metadata=b0a2d80d1f1a6786 -C extra-filename=-b0a2d80d1f1a6786 --out-dir /private/tmp/demo/target/debug/build/syn-b0a2d80d1f1a6786 -L dependency=/private/tmp/demo/target/debug/deps --cap-lints allow -C link-arg=-fuse-ld=/usr/local/bin/zld`
     Running `/private/tmp/demo/target/debug/build/syn-b0a2d80d1f1a6786/build-script-build`
     Running `/private/tmp/demo/target/debug/build/proc-macro2-ea7ca98ab7742a44/build-script-build`
     Running `rustc --crate-name proc_macro2 --edition=2018 /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.24/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg &#39;feature=&quot;default&quot;&#39; --cfg &#39;feature=&quot;proc-macro&quot;&#39; -C metadata=77d7c0427502f4b0 -C extra-filename=-77d7c0427502f4b0 --out-dir /private/tmp/demo/target/debug/deps -L dependency=/private/tmp/demo/target/debug/deps --extern unicode_xid=/private/tmp/demo/target/debug/deps/libunicode_xid-cd7f9054a6f1f9e9.rmeta --cap-lints allow -C link-arg=-fuse-ld=/usr/local/bin/zld --cfg lexerror_display --cfg hygiene --cfg use_proc_macro --cfg wrap_proc_macro`
   Compiling quote v1.0.9
     Running `rustc --crate-name quote --edition=2018 /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-1.0.9/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg &#39;feature=&quot;default&quot;&#39; --cfg &#39;feature=&quot;proc-macro&quot;&#39; -C metadata=e9f324783849396d -C extra-filename=-e9f324783849396d --out-dir /private/tmp/demo/target/debug/deps -L dependency=/private/tmp/demo/target/debug/deps --extern proc_macro2=/private/tmp/demo/target/debug/deps/libproc_macro2-77d7c0427502f4b0.rmeta --cap-lints allow -C link-arg=-fuse-ld=/usr/local/bin/zld`
     Running `rustc --crate-name syn --edition=2018 /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg &#39;feature=&quot;clone-impls&quot;&#39; --cfg &#39;feature=&quot;default&quot;&#39; --cfg &#39;feature=&quot;derive&quot;&#39; --cfg &#39;feature=&quot;parsing&quot;&#39; --cfg &#39;feature=&quot;printing&quot;&#39; --cfg &#39;feature=&quot;proc-macro&quot;&#39; --cfg &#39;feature=&quot;quote&quot;&#39; -C metadata=14a3acfd4550d423 -C extra-filename=-14a3acfd4550d423 --out-dir /private/tmp/demo/target/debug/deps -L dependency=/private/tmp/demo/target/debug/deps --extern proc_macro2=/private/tmp/demo/target/debug/deps/libproc_macro2-77d7c0427502f4b0.rmeta --extern quote=/private/tmp/demo/target/debug/deps/libquote-e9f324783849396d.rmeta --extern unicode_xid=/private/tmp/demo/target/debug/deps/libunicode_xid-cd7f9054a6f1f9e9.rmeta --cap-lints allow -C link-arg=-fuse-ld=/usr/local/bin/zld --cfg syn_disable_nightly_tests`
   Compiling linkme-impl v0.2.4
     Running `rustc --crate-name linkme_impl --edition=2018 /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/linkme-impl-0.2.4/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type proc-macro --emit=dep-info,link -C prefer-dynamic -C embed-bitcode=no -C debuginfo=2 -C metadata=38fa65aaf917537e -C extra-filename=-38fa65aaf917537e --out-dir /private/tmp/demo/target/debug/deps -L dependency=/private/tmp/demo/target/debug/deps --extern proc_macro2=/private/tmp/demo/target/debug/deps/libproc_macro2-77d7c0427502f4b0.rlib --extern quote=/private/tmp/demo/target/debug/deps/libquote-e9f324783849396d.rlib --extern syn=/private/tmp/demo/target/debug/deps/libsyn-14a3acfd4550d423.rlib --extern proc_macro --cap-lints allow -C link-arg=-fuse-ld=/usr/local/bin/zld`
   Compiling linkme v0.2.4
     Running `rustc --crate-name linkme --edition=2018 /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/linkme-0.2.4/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=0c3a40defd6b4791 -C extra-filename=-0c3a40defd6b4791 --out-dir /private/tmp/demo/target/debug/deps -L dependency=/private/tmp/demo/target/debug/deps --extern linkme_impl=/private/tmp/demo/target/debug/deps/liblinkme_impl-38fa65aaf917537e.dylib --cap-lints allow -C link-arg=-fuse-ld=/usr/local/bin/zld`
   Compiling demo v0.1.0 (/private/tmp/demo)
     Running `rustc --crate-name demo --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --crate-type=bin --cfg=spec -C metadata=c8a56b20f7b3cd31 -C extra-filename=-c8a56b20f7b3cd31 --out-dir /private/tmp/demo/target/debug/deps -C incremental=/private/tmp/demo/target/debug/incremental -L dependency=/private/tmp/demo/target/debug/deps --extern linkme=/private/tmp/demo/target/debug/deps/liblinkme-0c3a40defd6b4791.rmeta -C link-arg=-fuse-ld=/usr/local/bin/zld`
warning: function is never used: `adder`
 --&gt; src/lib.rs:1:4
  |
1 | fn adder(a: i32, b: i32) -&gt; i32 {
  |    ^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

error: crate `linkme` required to be available in rlib format, but was not found in this form

error: aborting due to previous error; 1 warning emitted

error: could not compile `demo`

Caused by:
  process didn&#39;t exit successfully: `rustc --crate-name demo --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --crate-type=bin --cfg=spec -C metadata=c8a56b20f7b3cd31 -C extra-filename=-c8a56b20f7b3cd31 --out-dir /private/tmp/demo/target/debug/deps -C incremental=/private/tmp/demo/target/debug/incremental -L dependency=/private/tmp/demo/target/debug/deps --extern linkme=/private/tmp/demo/target/debug/deps/liblinkme-0c3a40defd6b4791.rmeta -C link-arg=-fuse-ld=/usr/local/bin/zld` (exit code: 1)
</code></pre></div>



<a name="231024429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231024429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231024429">(Mar 19 2021 at 13:45)</a>:</h4>
<p>&lt;deleted&gt;</p>



<a name="231024538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231024538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hyd-dev <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231024538">(Mar 19 2021 at 13:46)</a>:</h4>
<p>Maybe this is related: <a href="https://github.com/rust-lang/miri/issues/1705#issuecomment-778651455">https://github.com/rust-lang/miri/issues/1705#issuecomment-778651455</a></p>



<a name="231024988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231024988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231024988">(Mar 19 2021 at 13:49)</a>:</h4>
<div class="codehilite"><pre><span></span><code>% find target/debug -name &#39;*linkme*.r*&#39;
target/debug/deps/liblinkme-0c3a40defd6b4791.rlib
target/debug/deps/liblinkme-0c3a40defd6b4791.rmeta
</code></pre></div>



<a name="231025197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231025197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231025197">(Mar 19 2021 at 13:50)</a>:</h4>
<p>And what does <code>RUSTC_LOG=rustc_metadata=info</code> give?</p>



<a name="231025263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231025263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231025263">(Mar 19 2021 at 13:50)</a>:</h4>
<p>Adding <code>--extern linkme=/private/tmp/demo/target/debug/deps/liblinkme-0c3a40defd6b4791.rlib</code> <em>does</em> allow compilation to finish, but that's not the most sustainable solution <span aria-label="wink" class="emoji emoji-1f609" role="img" title="wink">:wink:</span>.</p>



<a name="231025520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231025520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231025520">(Mar 19 2021 at 13:52)</a>:</h4>
<p><span class="user-mention silent" data-user-id="133247">bjorn3</span> <a href="#narrow/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format/near/231025197">said</a>:</p>
<blockquote>
<p>And what does <code>RUSTC_LOG=rustc_metadata=info</code> give?</p>
</blockquote>
<p>It's reasonably long: <a href="https://gist.github.com/shepmaster/e4998a33c606738a8981cb0e6f5f3b95">https://gist.github.com/shepmaster/e4998a33c606738a8981cb0e6f5f3b95</a></p>



<a name="231025942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231025942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231025942">(Mar 19 2021 at 13:56)</a>:</h4>
<div class="codehilite"><pre><span></span><code>  name: linkme
  cnum: 16
  hash: 5adccf8e4169bff2
  reqd: Explicit
   rmeta: /private/tmp/demo/target/debug/deps/liblinkme-0c3a40defd6b4791.rmeta
</code></pre></div>
<p>I think this is the build pipelining of cargo. Cargo only tells rustc about the rmeta files while compiling rlibs. Only when compiling things that need to be linked, will it tell the rlib path to rustc. This allows for starting compilation of dependent crates before the dependency is completely codegened. Only the crate metadata is necessary. You can disable this using <code>CARGO_PIPELINING=0</code> I think.</p>



<a name="231026428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231026428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231026428">(Mar 19 2021 at 13:59)</a>:</h4>
<p>That would fit with the Cargo bug report I linked earlier, but doesn't seem to resolve it:</p>
<div class="codehilite"><pre><span></span><code>CARGO_PIPELINING=0 cargo rustc -v -- --crate-type=bin --cfg=spec
...
error: crate `linkme` required to be available in rlib format, but was not found in this form
</code></pre></div>



<a name="231026498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231026498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231026498">(Mar 19 2021 at 13:59)</a>:</h4>
<p>Oh, maybe it's a different name</p>



<a name="231026575"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231026575" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231026575">(Mar 19 2021 at 14:00)</a>:</h4>
<p><code>CARGO_BUILD_PIPELINING=false</code></p>



<a name="231026640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231026640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231026640">(Mar 19 2021 at 14:00)</a>:</h4>
<p>Alright!</p>



<a name="231026802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231026802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231026802">(Mar 19 2021 at 14:01)</a>:</h4>
<p>Thank you both!</p>



<a name="231029392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231029392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231029392">(Mar 19 2021 at 14:19)</a>:</h4>
<p>Too bad it appears that pipelining is an all-or-nothing setting in <code>config.toml</code> and I can't set environment variables in a cargo alias.</p>
<p>Guess I'll need to create my own <code>cargo-foo</code> command.</p>



<a name="231029480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231029480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231029480">(Mar 19 2021 at 14:19)</a>:</h4>
<p>Can you use <code>crate-type = ["lib", "bin"]</code>?</p>



<a name="231030257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231030257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231030257">(Mar 19 2021 at 14:24)</a>:</h4>
<p>Perhaps, but I'd prefer not to. That would be relatively intrusive on the end user. I'm trying to reimplement a test framework, so reducing touchpoints should help with adoption.</p>



<a name="231030304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231030304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231030304">(Mar 19 2021 at 14:24)</a>:</h4>
<p>Conversely, doing a one-time <code>cargo install ...</code> shouldn't be terrible.</p>



<a name="231030632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231030632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231030632">(Mar 19 2021 at 14:27)</a>:</h4>
<p>Now to figure out which <code>deps/programname-HASH</code> is the one I should run...</p>



<a name="231031011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231031011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231031011">(Mar 19 2021 at 14:29)</a>:</h4>
<p><code>--message-format json</code> gives the names of all emitted artifact I think.</p>



<a name="231031346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231031346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231031346">(Mar 19 2021 at 14:31)</a>:</h4>
<p>I guess I can run the compiler once to get human output, then again when capturing it and parse the JSON.</p>



<a name="231032073"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231032073" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231032073">(Mar 19 2021 at 14:35)</a>:</h4>
<p>And the cargo output does not know that I'm passing <code>--crate-type=bin</code>, which makes sense :-)</p>



<a name="231032584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231032584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231032584">(Mar 19 2021 at 14:38)</a>:</h4>
<p>Shame that <code> -C metadata=spec -C extra-filename=-spec</code> doesn't override <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="231435475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/crate%20required%20to%20be%20available%20in%20rlib%20format/near/231435475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/crate.20required.20to.20be.20available.20in.20rlib.20format.html#231435475">(Mar 23 2021 at 08:22)</a>:</h4>
<p>I suggested to make cargo aware of --crate-type being passed to <code>cargo rustc</code> but it was deemed too brittle</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>